package exotica.rs2.net;

import java.net.InetSocketAddress;
import java.util.concurrent.Executors;

import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;

/**
 * @author Sir Tom
 *
 */
public class ServerChannel implements Runnable {

	/**
	 * binds to port sets the options and sets the pipeline factory
	 */
	@Override
	public void run() {
		try {
			ServerBootstrap serverStrap = new ServerBootstrap(
					new NioServerSocketChannelFactory(
							Executors.newCachedThreadPool(),
							Executors.newCachedThreadPool()));
			serverStrap.setPipelineFactory(new ServerPipelineFactory());
			serverStrap.setOption("child.tcpNoDelay", true);
			serverStrap.bind(new InetSocketAddress(43594));
		} catch (Exception _e) {
			_e.printStackTrace();
		}
	}
}
